<!-- //执行部门 -->
<template>
	<view class="viewBg">
		<view class="lineH20"></view>
		<view class="uni-padding-wrap uni-common-mt" v-for="(item,index) in list" :key="index">
			<view class="uni-card">
				<view class="uni-card-content">
					<view class="uni-card-content-inner">
						<view class="">部门名称: {{item.name}}</view>
						<view class="">职责范围: {{item.duty}}</view>
						<view class="checkUserView">
							<text @click="checkUser(item)">查看人员</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				searchKey: '',
				current: 0,
				activeColor: '#007aff',
				styleType: 'button',

				reload: false,

				pageNo: 1,
				viewStatus: 0,
			};
		},
		onLoad() {
			this.getList();
		},
		onReachBottom() {
			this.pageNo++;
			this.getList();
		},
		methods: {
			getList() {
				this.reload = false;
				uni.stopPullDownRefresh();

				this.$http.get('ac/xagrid/appDepartmentService/getDepartmentList', {
					pageNo: this.pageNo,
					pageSize: 10
				}).then((res) => {
					if (res.errcode === '0') {
						const obj = res.data.results;
						if (obj.length > 0) {
							this.list = this.list.concat(obj);
						}
					} else {
						console.log("错误信息" + res.errmsg);
						uni.showToast({
							title: res.errmsg,
							mask: false,
							duration: 1500
						});
					}
				});
			},
			checkUser: function(item) {
				uni.navigateTo({
					url: "../executeUser/executeUser?deptName=" + item.name + '&duty=' + item.duty + '&gridId=' + item.gridId
				})
			},
		}
	}
</script>

<style>
	.viewBg {
		width: 100%;
		height: 100%;
		/* background-color: #0FAEFF; */
	}

	.lineH20 {
		height: 20upx;
		width: 100%;
		background-color: #F7F7F7;
	}

	.lineH1 {

		height: 2upx;
		width: 100%;
		/* margin-left: 10upx; */
		background-color: #F7F7F7;
	}

	.checkUserView {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		width: 100%;
		height: 40upx;
		color: #007AFF;
	}
</style>
